package com.koro.controller;

import com.koro.dto.SaveUsersDTO;
import com.koro.service.UsersService;
import com.koro.vo.ResponseObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户管理")
@RequestMapping("/users")
@RestController
public class UsersController {

    @Autowired
    private UsersService usersService;

    @PostMapping("/save")
    @ApiModelProperty(value = "用户更新",notes = "用户更新")
    public ResponseObject<Integer> save(SaveUsersDTO dto) {
        return ResponseObject.ok(usersService.save(dto));
    }

    @ApiOperation(value = "用户同步到ES接口", notes = "用户同步到ES接口")
    @PostMapping("/synGoodsES")
    public ResponseObject synGoodsES() {
        usersService.synGoodsES();
        return ResponseObject.ok();
    }
}
